
<%@ include file="/pages/header.jsp"%>

<f:view>
	<html>
	<%@ include file="/pages/head.jsp"%>
	<script type="text/javascript">
	function meuSubmeter(valor){
		texto = document.getElementById('recuperarArquivo:chave');

		texto.value = valor;



		botao = document.getElementById('recuperarArquivo:download');
		botao.click();

	}

</script>
	<body>
	<div class="divpos">

	<table width="100%" height="100%">

		<%@ include file="/pages/banner.jsp"%>

		<tr>
			<td width="100%" height="100%" class="fonte"><br><br>
			<h:outputText value="#{msg.resultado_pesquisa}" /><br><br>
			<h:dataTable id="resultado"	value="#{obraController.obraPesquisa.obras}" var="item" border="2" cellpadding="5"
			cellspacing="3" first="0" summary="Tabela de Obras." columnClasses="fonte">

				<h:column headerClass="tamanho">
					<h:outputLink id="downloadFile" onclick="meuSubmeter('#{item.id}');" value="##{item.id}" >
						<f:verbatim escape="false">download</f:verbatim>
					</h:outputLink>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.titulo_p}" />
					</f:facet>
					<h:outputText value="#{item.titulo}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.nota_p}" />
					</f:facet>
					<h:outputText value="#{item.nota}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.data_p}" />
					</f:facet>
					<h:outputText value="#{item.data}"></h:outputText>
				</h:column>
			</h:dataTable></td>

		</tr>
	</table>
	</div>



	<h:form id="recuperarArquivo">
		<h:inputHidden id="chave" value="#{obraController.obraPesquisa.id}"></h:inputHidden>
		<div style="visibility: hidden"><h:commandButton id="download" action="#{obraController.retrieveArquivo}" value="Download" /></div>
	</h:form>

	</body>

	</html>

</f:view>
<%@ include file="/pages/footer.jsp"%>